/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Salem_NotePad;

import java.awt.Color;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.SwingConstants;
import javax.swing.event.MenuKeyListener;

/**
 *
 * @author M S H
 */
public   class Creates{
    
  public JMenu create_JMenu(JMenu men,String tooltip,String image_path,JMenuBar bar){
        men = new JMenu();
        men.setToolTipText(tooltip);
        men.setIcon(new ImageIcon(image_path));
        men.setIconTextGap(4);
        men.setIgnoreRepaint(true);
        men.setHorizontalTextPosition(SwingConstants.CENTER);
        men.setBorderPainted(false);
        men.setFocusPainted(true);
        men.setContentAreaFilled(false);
        men.setForeground(Color.RED);
        
        bar.add(men);
        return men;
    }
    public JMenuItem create_JMenuItem(JMenuItem item ,String label,String tooltip,String image_path,ActionListener s,MenuKeyListener m,JMenu mymenu){
        item = new JMenuItem(label);
        item.setIcon(new ImageIcon(image_path));
        item.setToolTipText(tooltip);
       item.addMenuKeyListener(m);
       item.addActionListener(s);  
        mymenu.add(item);
        return item;
    }
     public JMenuItem create_JMenuItem_pop(JMenuItem item ,String label,String tooltip,String image_path,ActionListener s,MenuKeyListener m,JPopupMenu mymenu){
        item = new JMenuItem(label);
        item.setIcon(new ImageIcon(image_path));
        item.setToolTipText(tooltip);
       item.addMenuKeyListener(m);
       item.addActionListener(s);  
        mymenu.add(item);
        return item;
    }
         public JMenuItem create_JMenuItem_pop_menu(JMenuItem item ,String label,String tooltip,String image_path,ActionListener s,MenuKeyListener m,JPopupMenu mymenu){
        item = new JMenu(label);
        item.setIcon(new ImageIcon(image_path));
        item.setToolTipText(tooltip);
        item.addMenuKeyListener(m);
        item.addActionListener(s);  
        mymenu.add(item);
        return item;
    }
        public JMenuItem create_JMenuItem_menu(JMenuItem item ,String label,String tooltip,String image_path,ActionListener s,MenuKeyListener m,JMenu mymenu){
        item = new JMenu(label);
        item.setIcon(new ImageIcon(image_path));
        item.setToolTipText(tooltip);
         item.addMenuKeyListener(m);
         item.addActionListener(s);  
        mymenu.add(item);
        return item;
    }
        
      public JRadioButtonMenuItem create_JRadio_menu(JRadioButtonMenuItem item,String label ,String tooltip,String image_path,ActionListener m,JMenuItem men){
          item = new JRadioButtonMenuItem(label);
          item.setToolTipText(tooltip);
       item.addActionListener(m);  
          men.add(item);
          return item;
      }
     public JMenuItem create_JCheck_menu(JMenuItem item,String label ,String tooltip,String image_path,ActionListener m,MenuKeyListener kry,JMenuItem men){
          item = new JCheckBoxMenuItem(label);
          item.setToolTipText(tooltip);
       item.addActionListener(m);  
        item.addMenuKeyListener(kry);
          men.add(item);
          return item;
      }
         public JRadioButtonMenuItem create_JRadio_menu_pop(JRadioButtonMenuItem item,String label ,String tooltip,String image_path,ActionListener s,JPopupMenu men){
          item = new JRadioButtonMenuItem(label);
          item.setToolTipText(tooltip);
          item.addActionListener(s);  
          men.add(item);
          return item;
      }
    public JButton create_JButton(JButton b,String tooltip,String image_path,ActionListener s){
        b = new JButton();
        b.addActionListener(s);
        b.setIcon(new ImageIcon(image_path));
        b.setToolTipText(tooltip);
        return  b;
    }
//*********************************************************************************************       
}
